$.entwine(ꞌssꞌ)   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
c 0
b 0
f 0
rs 9.4285
cc 1
nc 1
nop 0
1
import SearchForm from './modules/SearchForm';
2
3
(function ($) {
4
    $.entwine('ss', function ($) {
5
        $('#lang-editor-cms-content').entwine({
6
            onmatch: function () {
7
                window.langeditor = {
8
                    instances: [],
9
                    modules: [
10
                        {name: 'search-form', class: SearchForm}
11
                    ]
12
                };
13
14
                window.langeditor.modules.forEach((item) => {
15
                    // try to find an element
16
                    let element = $(this).find(`*[data-module="${item.name}"]`);
17
18
                    if (element.length) {
19
                        window.langeditor.instances.push(new item.class(element[0]));
20
                    }
21
                });
22
            }
23
        });
24
    });
25
})(jQuery);